<template>
	<view class="container">
		<uni-section title="食物列表展示" sub-title="" type="line">
			<uni-list v-for="(item,index) in commentList">
				<navigator :url="'../commentdetail/commentdetail?id='+item.id">
					<uni-list-item :title="item.comment" note="" :rightText="item.postdate" v-if="index < 3">
					</uni-list-item>
				</navigator>
			</uni-list>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				commentList: []
			}
		},
		methods: {
			commentListm() {
				uni.request({
					url: 'http://localhost:8090/foodapp/comment/list',
					method: 'POST',
					data: {},
					success: res => {
						if (res.data.success) {
							this.commentList = res.data.list
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
		},
		onLoad() {
			this.commentListm()
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
